package com.blueocean_health.care.management.transfer.server;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.dto.ManyToManyPercentagesDto;
import com.blueocean_health.care.management.domain.dvo.ManyToManyDvo;
import com.blueocean_health.care.management.service.ManyToManyPercentagesService;

/**
 * 多对多提成报表接口  2018年5月25日16:24:20
 * @author wuyanli
 *
 */
@RestController
@RequestMapping(value = "percentages")
//@CrossOrigin
public class ManyToManyPercentagesController{

	@Resource
	private ManyToManyPercentagesService manyService;
	/**
	 * 多对多提成报表  2018年5月25日16:24:38
	 * @return
	 */
	@RequestMapping("list")
	public SysResult getPercentagesList(@RequestBody ManyToManyDvo manyDvo){
//		ManyToManyDvo manyDvo = JsonSerializUtil.jsonToJava(jsonStr, ManyToManyDvo.class);
		Map<String,String> map = new HashMap<>();
		map.put("endTime", manyDvo.getEndTime());
		map.put("groupId", manyDvo.getGroupId());
		map.put("hospitalId", manyDvo.getTeamId());
		map.put("searchKey", manyDvo.getSearchKey());
		map.put("startTime", manyDvo.getStartTime());
		map.put("page", manyDvo.getPage()+"");
		map.put("pageSize", manyDvo.getPageSize()+"");
		SysResult manyToManyTable = manyService.manyToManyTable(map);
		return manyToManyTable;
		
	}
	
	/**
	 * 导出多对多提成表 Excel  2018年6月1日16:41:44
	 * @param map
	 * @return
	 */
	@RequestMapping("excel")
	public List<ManyToManyPercentagesDto> getPercentagesListExcel(@RequestBody ManyToManyDvo manyDvo){
//		ManyToManyDvo manyDvo = JsonSerializUtil.jsonToJava(jsonStr, ManyToManyDvo.class);
		Map<String,String> map = new HashMap<>();
		map.put("endTime", manyDvo.getEndTime());
		map.put("groupId", manyDvo.getGroupId());
		map.put("hospitalId", manyDvo.getTeamId());
		map.put("searchKey", manyDvo.getSearchKey());
		map.put("startTime", manyDvo.getStartTime());
		List<ManyToManyPercentagesDto> percentagesExcel = manyService.getPercentagesExcel(map);
		return percentagesExcel;
	}
}
